function IE6UpgradeMessage() {
	IE6UpgradeMessage.createCookie = function (name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}
	IE6UpgradeMessage.readCookie = function (name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	IE6UpgradeMessage.eraseCookie = function (name) {
		IE6UpgradeMessage.createCookie(name,"",-1);
	}
	IE6UpgradeMessage.defaultvalue = function (varname,val) {
		eval("if (typeof(IE6UpgradeMessage."+varname+")=='undefined') {IE6UpgradeMessage."+varname+"=\""+val+"\";}");
	}
	IE6UpgradeMessage.pageload = function () {
		var nag = IE6UpgradeMessage.readCookie("ie6nag");
		//var nag = "";
		if (nag!="false") {
			IE6UpgradeMessage.defaultvalue('text',"We notice you are still using Internet Explorer 6.  Click here to find out why we think you should switch.");
			IE6UpgradeMessage.defaultvalue('url',"http://whyswitchfromie6.dtcnet.co.uk/");
			var newdiv = document.createElement('div');
			document.body.appendChild(newdiv);
			newdiv.innerHTML = " <div id=\"ie6note\" style=\"z-index:1000; position:absolute; top:-20; left:0; padding:1px; width:100%; text-align:center; background-color:rgb(250,255,180); border-bottom:gray 1px solid;\"> \
					<a href=\""+IE6UpgradeMessage.url+"\" style=\"color: black; font: 12px Arial, Helvetica, Geneva, sans-serif; text-decoration:none;\" target=\"_blank\"> \
						"+IE6UpgradeMessage.text+" \
					</a> \
					<a style=\"position:absolute; top:3px; right:5px; color: black; font: 12px Arial, Helvetica, Geneva, sans-serif; text-decoration:none;\" href=\"#closeie6note\" onclick=\"IE6UpgradeMessage.closeIE6msg();return false;\">X</a> \
				</div>";
			if (document.documentElement.clientHeight) {
				document.getElementById('ie6note').style.width = (document.documentElement.clientWidth-2)+"px";
			}
			else {
				document.getElementById('ie6note').style.width = (document.body.clientWidth-2)+"px";
			}
			if(nag!="true") {
				IE6UpgradeMessage.createCookie("ie6nag","true");
				for (var i=0;i<=20;i++) {
					t=i*50;
					window.setTimeout("document.getElementById('ie6note').style.top="+(document.documentElement.scrollTop-20+i)+"+\"px\"; document.body.style.marginTop = (parseInt(document.body.currentStyle.marginTop)+1)+\"px\";",t);
					if (i==20) {
						window.setTimeout("IE6UpgradeMessage.pagescroll();window.attachEvent( 'onscroll', IE6UpgradeMessage.pagescroll );",t);
					}
				}
			}
			else {
				document.body.style.marginTop = (parseInt(document.body.currentStyle.marginTop)+20)+"px";
				IE6UpgradeMessage.pagescroll();
				window.attachEvent( 'onscroll', IE6UpgradeMessage.pagescroll );
			}
			
		}
	}
	IE6UpgradeMessage.closeIE6msg = function () {
		IE6UpgradeMessage.createCookie("ie6nag","false");
		document.getElementById('ie6note').style.display='none';
		document.body.style.marginTop = (parseInt(document.body.currentStyle.marginTop)-20)+"px";
	}
	IE6UpgradeMessage.pagescroll = function () {
		document.getElementById('ie6note').style.top = document.documentElement.scrollTop+"px";
		document.getElementById('ie6note').style.left = document.documentElement.scrollLeft+"px";
	}
	window.attachEvent( 'onload', IE6UpgradeMessage.pageload );
	
}
IE6UpgradeMessage();